/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Huu Vinh
 */
@Entity
@Table(name = "Order", catalog = "Radio_Cabs", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Order1.findAll", query = "SELECT o FROM Order1 o"),
    @NamedQuery(name = "Order1.findByOrderId", query = "SELECT o FROM Order1 o WHERE o.orderId = :orderId"),
    @NamedQuery(name = "Order1.findByOrderStart", query = "SELECT o FROM Order1 o WHERE o.orderStart = :orderStart"),
    @NamedQuery(name = "Order1.findByOrderEnd", query = "SELECT o FROM Order1 o WHERE o.orderEnd = :orderEnd"),
    @NamedQuery(name = "Order1.findByContent", query = "SELECT o FROM Order1 o WHERE o.content = :content")})
public class Order1 implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "OrderId", nullable = false, length = 8)
    private String orderId;
    @Basic(optional = false)
    @Column(name = "OrderStart", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderStart;
    @Basic(optional = false)
    @Column(name = "OrderEnd", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderEnd;
    @Basic(optional = false)
    @Column(name = "Content", nullable = false, length = 2147483647)
    private String content;
    @JoinColumn(name = "CityId", referencedColumnName = "CityId", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private City cityId;
    @JoinColumn(name = "AccId", referencedColumnName = "AccId", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Accounts accId;

    public Order1() {
    }

    public Order1(String orderId) {
        this.orderId = orderId;
    }

    public Order1(String orderId, Date orderStart, Date orderEnd, String content) {
        this.orderId = orderId;
        this.orderStart = orderStart;
        this.orderEnd = orderEnd;
        this.content = content;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public Date getOrderStart() {
        return orderStart;
    }

    public void setOrderStart(Date orderStart) {
        this.orderStart = orderStart;
    }

    public Date getOrderEnd() {
        return orderEnd;
    }

    public void setOrderEnd(Date orderEnd) {
        this.orderEnd = orderEnd;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public City getCityId() {
        return cityId;
    }

    public void setCityId(City cityId) {
        this.cityId = cityId;
    }

    public Accounts getAccId() {
        return accId;
    }

    public void setAccId(Accounts accId) {
        this.accId = accId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (orderId != null ? orderId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Order1)) {
            return false;
        }
        Order1 other = (Order1) object;
        if ((this.orderId == null && other.orderId != null) || (this.orderId != null && !this.orderId.equals(other.orderId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Order1[ orderId=" + orderId + " ]";
    }
    
}
